﻿using Microsoft.AspNetCore.Mvc;
using Orm.Entities;
using Scm.Jwt.Dto;
using Scm.Service.Dto;
using Scm.Service.Services;

namespace Scm.Api.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class UserController : ControllerBase
    {

        private UserService _userSrv = new();

        [HttpGet("GetUserByUsername")]
        public ScmUser GetUserByUsername(string username) => _userSrv.GetUserByUsername(username);

        [HttpPost("Login")]
        public BaseDto<AccessToken> Login(LoginDto Dto) =>  _userSrv.Login(Dto);

        [HttpPost("Regist")]
        public BaseDto<AccessToken> Regist(RegDto Dto) => _userSrv.Regist(Dto);

    }
}
